<?php
/*
 *  @author Nicolas Genevaux
 * (c)nige 2008
 */
	include_once($RACINE.'inc/cla.inscrit.php');
	include_once($RACINE.'inc/cla.detailinscrit.php');
	include_once($RACINE.'inc/fct.basedonnee.php');
	include_once($RACINE.'inc/sql.inscrit.php');
	include_once($RACINE.'inc/var.pages.php');
	if($_POST['valider']) {
		$detailInscrit = new detailinscrit($_POST);
		doSQL($DETAILINSCRIT_UPDATE,array(0=>"'".$_SESSION['ID_CONECT']."'",1=>"'".$detailInscrit->nom."'",2=>"'".$detailInscrit->prenom."'",3=>"'".$detailInscrit->sexe."'",4=>"'".$detailInscrit->datenaissance."'",5=>"'".$detailInscrit->mail."'"));
		redirect($PAGE_MONPROFIL.'?ok=1');
	}
	else if($_POST['changer']) {
		$inscrit = new inscrit($_POST);
		if($inscrit->motdepasse=='') {
			redirect($PAGE_MONPROFIL.'?errcode=1');
		}
		else {
			$res = doSQL($INSCRIT_COMPTE_LOGIN,array(0 =>"'".$inscrit->login."'"));
			if($res['total']==0 || $inscrit->login==$INSCRIT->login) {
				doSQL($INSCRIT_UPDATE,array(0=>"'".$_SESSION['ID_CONECT']."'",1=>"'".$inscrit->login."'",2=>"'".$inscrit->motdepasse."'"));
				redirect($PAGE_MONPROFIL.'?ok=1');
			}
			else {
				redirect($PAGE_MONPROFIL.'?errcode=2');
			}
		}
	}
	redirect($PAGE_ACCUEIL);
?>
